#!/usr/bin/env perl
use strict;
use warnings;
use List::Util qw(min);
use List::Util qw(max);
use Time::Local;

#system "git pull origin master";
my %hash;
open (IN, "< add.txt") or die;
foreach (<IN>) {
    chomp;
    my ($id) = split m/\s+/;
    next if length($_) <= 10;
    $hash{$id} = 0 unless defined($hash{$id});
    $hash{$id}++ if defined($hash{$id});
}
close(IN);
open (IN, "< add1.txt") or die;
foreach (<IN>) {
    chomp;
    my ($id, undef, undef, undef, undef, $score) = split m/\s+/;
    next unless defined($score);
    $hash{$id} = 0 unless defined($hash{$id});
    $hash{$id} = $score + $hash{$id} if defined($hash{$id});
}
close(IN);
open (OUT, "> README.md") or die;
print OUT "|ID|score|\n|-|-|\n";
foreach my $id (sort {$a<=>$b} keys %hash) {
    print OUT "|$id| $hash{$id}|\n";
}
close(OUT);
#system "git add --all";
#system "git commit -m'update'";
#system "git push origin master";
